package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "chat_record", schema = "crm")
public class ChatRecord {
    private int chatRecordId;
    private String chatRecordContent;
    private Timestamp chatRecordDate;
    private Employee employeeByEmpId;
    private Task taskByTaskId;

    @Id
    @Column(name = "chat_record_id", nullable = false)
    public int getChatRecordId() {
        return chatRecordId;
    }

    public void setChatRecordId(int chatRecordId) {
        this.chatRecordId = chatRecordId;
    }

    @Basic
    @Column(name = "chat_record_content", nullable = true, length = 255)
    public String getChatRecordContent() {
        return chatRecordContent;
    }

    public void setChatRecordContent(String chatRecordContent) {
        this.chatRecordContent = chatRecordContent;
    }

    @Basic
    @Column(name = "chat_record_date", nullable = true)
    public Timestamp getChatRecordDate() {
        return chatRecordDate;
    }

    public void setChatRecordDate(Timestamp chatRecordDate) {
        this.chatRecordDate = chatRecordDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ChatRecord that = (ChatRecord) o;
        return chatRecordId == that.chatRecordId &&
                Objects.equals(chatRecordContent, that.chatRecordContent) &&
                Objects.equals(chatRecordDate, that.chatRecordDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(chatRecordId, chatRecordContent, chatRecordDate);
    }

    @ManyToOne
    @JoinColumn(name = "emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByEmpId() {
        return employeeByEmpId;
    }

    public void setEmployeeByEmpId(Employee employeeByEmpId) {
        this.employeeByEmpId = employeeByEmpId;
    }

    @ManyToOne
    @JoinColumn(name = "task_id", referencedColumnName = "task_id")
    public Task getTaskByTaskId() {
        return taskByTaskId;
    }

    public void setTaskByTaskId(Task taskByTaskId) {
        this.taskByTaskId = taskByTaskId;
    }


}
